Welcome Guest. Please Login or Register  


You are here: Index > Webuzo > General Support > Topic : "server" directive is not allowed here in /usr/local/apps/nginx/etc/conf.d/



Threaded Mode | Print  

 "server" directive is not allowed here in /usr/local/apps/nginx/etc/conf.d/, what i did wrong here ? (2 Replies, Read 17013 times)
TOMER628
Group: Member
Post Group: Newbie
Posts: 8
Status:
hi !

i got this Error :

"server" directive is not allowed here in /usr/local/apps/nginx/etc/conf.d/mydomain.com.conf:1
nginx: configuration file /usr/local/apps/nginx/etc/nginx.conf test failed

this what i did...
i configured nginx.conf to this settings:

PHP Code

 server {
    
listen       127.0.0.1:8080;
    
server_name  mydomain.com;

    
port_in_redirect off;
    
server_tokens off;
    
autoindex off;

    
client_max_body_size 15m;
    
client_body_buffer_size 128k;

    
access_log  /usr/local/apps/nginx/var/log/mydomain.com.log main;
    
error_log   /usr/local/apps/nginx/var/log/mydomain.com.err;

    
root   /home/www-data/public_html;
    
index index.php  index.html index.htm;
    
try_files $uri $uri/ /index.php;

    
error_page  404              /404.html;
    
location = /404.html {
        
root   /usr/local/apps/nginx/etc//html;
    
}

    
# Define default caching of 24h
    
expires 86400s;
    
add_header Pragma public;
    
add_header Cache-Control "max-age=86400, public, must-revalidate, proxy-revalidate";

    
# Redirect server error pages to static 50x.html
    
error_page   500 502 503 504  /50x.html;
    
location = /50x.html {
        
root   /usr/local/apps/nginx/etc//html;
    
}

    
# Don't log robots.txt requests
    
location = /robots.txt {
        
allow all;
        
log_not_found off;
        
access_log off;
    }

    
# Rewrite for versioned CSS+JS via filemtime
    
location ~* ^.+.(css|js) {
        
rewrite ^(.+).(d+).(css|js)$ $1.$3 last;
        
expires 31536000s;
        
access_log off;
        
log_not_found off;
        
add_header Pragma public;
        
add_header Cache-Control "max-age=31536000, public";
    }

    
# Aggressive caching for static files
    # If you alter static files often, please use
    # add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate";
    
location ~* .(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|ogv|otf|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|t?gz|tif|tiff|ttf|wav|webm|wma|woff|wri|xla|xls|xlsx|xlt|xlw|zip)$ {
        
expires 31536000s;
        
access_log off;
        
log_not_found off;
        
add_header Pragma public;
        
add_header Cache-Control "max-age=31536000, public";
    }

    
location ~* (^(?!(?:(?!(php|inc)).)*/uploads/).*?(php)) {
        
try_files $uri 404;
        
fastcgi_split_path_info ^(.+.php)(.*)$;
        
fastcgi_pass unix:/var/run/php-fpm.socket;
        
fastcgi_index index.php;
        
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        
fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
        include /
usr/local/apps/nginx/etc/fastcgi_params;
        
fastcgi_intercept_errors on;
        
fastcgi_ignore_client_abort off;
        
fastcgi_connect_timeout 60;
        
fastcgi_send_timeout 180;
        
fastcgi_read_timeout 180;
        
fastcgi_buffer_size 128k;
        
fastcgi_buffers 4 256k;
        
fastcgi_busy_buffers_size 256k;
        
fastcgi_temp_file_write_size 256k;
    }





and after that i checked with nginx -t and it was ok...

I continued to the next file mydomain.com.conf and this what i putted there:
PHP Code

 server {
    
listen       127.0.0.1:8080;
    
server_name  mydomain.com;

    
port_in_redirect off;
    
server_tokens off;
    
autoindex off;

    
client_max_body_size 15m;
    
client_body_buffer_size 128k;

    
access_log  /usr/local/apps/nginx/var/log/mydomain.com.log main;
    
error_log   /usr/local/apps/nginx/var/log/mydomain.com.err;

    
root   /home/www-data/public_html;
    
index index.php  index.html index.htm;
    
try_files $uri $uri/ /index.php;

    
error_page  404              /404.html;
    
location = /404.html {
        
root   /usr/local/apps/nginx/etc//html;
    
}

    
# Define default caching of 24h
    
expires 86400s;
    
add_header Pragma public;
    
add_header Cache-Control "max-age=86400, public, must-revalidate, proxy-revalidate";

    
# Redirect server error pages to static 50x.html
    
error_page   500 502 503 504  /50x.html;
    
location = /50x.html {
        
root   /usr/local/apps/nginx/etc//html;
    
}

    
# Don't log robots.txt requests
    
location = /robots.txt {
        
allow all;
        
log_not_found off;
        
access_log off;
    }

    
# Rewrite for versioned CSS+JS via filemtime
    
location ~* ^.+.(css|js) {
        
rewrite ^(.+).(d+).(css|js)$ $1.$3 last;
        
expires 31536000s;
        
access_log off;
        
log_not_found off;
        
add_header Pragma public;
        
add_header Cache-Control "max-age=31536000, public";
    }

    
# Aggressive caching for static files
    # If you alter static files often, please use
    # add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate";
    
location ~* .(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg$
        
expires 31536000s;
        
access_log off;
        
log_not_found off;
        
add_header Pragma public;
        
add_header Cache-Control "max-age=31536000, public";
    }

    
location ~* (^(?!(?:(?!(php|inc)).)*/uploads/).*?(php)) {
        
try_files $uri 404;
        
fastcgi_split_path_info ^(.+.php)(.*)$;
        
fastcgi_pass unix:/var/run/php-fpm.socket;
        
fastcgi_index index.php;
        
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        
fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
        include /
usr/local/apps/nginx/etc/fastcgi_params;
        
fastcgi_intercept_errors on;
        
fastcgi_ignore_client_abort off;
        
fastcgi_connect_timeout 60;
        
fastcgi_send_timeout 180;
        
fastcgi_read_timeout 180;
        
fastcgi_buffer_size 128k;
        
fastcgi_buffers 4 256k;
        
fastcgi_busy_buffers_size 256k;
        
fastcgi_temp_file_write_size 256k;
    }





what worng here , how can i fix that ?

i sit on that almost 5 hours  :-(

thanks for all hwo can help me,
Tomer.
:-(
IP: --   

"server" directive is not allowed here in /usr/local/apps/nginx/etc/conf.d/
TOMER628
Group: Member
Post Group: Newbie
Posts: 8
Status:
sorry i forgot to add the content of nginx.conf :

Code:
PHP Code

 #user  www-data;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid        /usr/local/apps/nginx/var/log/nginx.pid;

events {
    
worker_connections  1024;
}


http {

    
# Let NGINX get the real client IP for its access logs
    
set_real_ip_from 127.0.0.1;
    
real_ip_header X-Forwarded-For;    


    
# Basic Settings
    
sendfile on;
    
tcp_nopush on;
    
tcp_nodelay on;
    
keepalive_timeout 20;
    
client_max_body_size 15m;
    
client_body_timeout 60;
    
client_header_timeout 60;
    
client_body_buffer_size  1K;
    
client_header_buffer_size 1k;
    
large_client_header_buffers 4 8k;
    
send_timeout 60;
    
reset_timedout_connection on;
    
types_hash_max_size 2048;
    
server_tokens off;
            
    
# server_names_hash_bucket_size 64;
    # server_name_in_redirect off;
    
    
include /usr/local/apps/nginx/etc/mime.types;
    
default_type application/octet-stream;

    
# Logging Settings
    
error_log /usr/local/apps/nginx/var/log/error_log debug;
    
access_log /usr/local/apps/nginx/var/log/web.access.log;

    
# Log Format
        
log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                                          '$status $body_bytes_sent "$http_referer" '
                                          '"$http_user_agent" "$http_x_forwarded_for"'
;

    
# Gzip Settings
    
gzip on;
    
gzip_static on;
    
gzip_disable "msie6";
    
gzip_vary on;
    
gzip_proxied any;
    
gzip_comp_level 6;
    
gzip_min_length 512;
    
gzip_buffers 16 8k;
    
gzip_http_version 1.1;
    
gzip_types text/css text/javascript text/xml text/plain text/x-component 
    application
/javascript application/x-javascript application/json 
    application
/xml  application/rss+xml font/truetype application/x-font-ttf 
    font
/opentype application/vnd.ms-fontobject image/svg+xml;

    include /
usr/local/apps/nginx/etc/conf.d/*.conf;


IP: --   

"server" directive is not allowed here in /usr/local/apps/nginx/etc/conf.d/
TOMER628
Group: Member
Post Group: Newbie
Posts: 8
Status:
someone maybe know what i need to fix that ? :P
IP: --   

« Previous    Next »

Threaded Mode | Print  



Jump To :


Users viewing this topic
1 guests, 0 users.


All times are GMT. The time now is May 1, 2024, 5:46 am.

  Powered By AEF 1.0.8 © 2007-2008 Electron Inc.Queries: 11  |  Page Created In:0.025